import { createRouter, createWebHashHistory } from 'vue-router'
const Layout = () =>
    import ('@/views/Layout')
const Home = () =>
    import ('@/views/home/index')
const Login = () =>
    import ('@/views/login/index')
const Goods = () =>
    import ('@/views/goods/index')
const Cart = () =>
    import ('@/views/cart/index')
const NotFound = () =>
    import ('@/components/404/notfound.vue')
const routes = [{
        path: '/',
        component: Layout,
        children: [{
            path: '/',
            component: Home
        }]
    },
    {
        path: '/login',
        component: Login,
    },
    {
        path: '/cart',
        component: Cart
    },
    {
        path: '/product',
        alias: '/goods',
        component: Goods
    },
    {
        path: '/:w+',
        name: '*',
        component: NotFound
    }
]

// 创建路由实例
const router = createRouter({
    // hash路由
    history: createWebHashHistory(),
    routes
})

export default router